Shader "Custom/Test1" {
	Properties {
		_Color("Color",color) = (1,1,1,1)
	}
	
	CGINCLUDE
// Upgrade NOTE: excluded shader from DX11 and Xbox360; has structs without semantics (struct v2f members color)
	#pragma exclude_renderers d3d11 xbox360
	#include "UnityCG.cginc"
	float4 _Color; //用这个固定值来做测试.
	struct v2f{
		float4 pos:POSITION; //顶点语义必须指定.
		float3 color; //这里我不指定.unity编译时,会加入d3d11,xbox360的去除指令.
	};
	
	v2f vert(appdata_base i){
		v2f o;
		o.pos = mul(UNITY_MATRIX_MVP,i.vertex); //vertex shader 中必须变换顶点.
		o.color = _Color; //vertex shader中不做任何处理,直接存入寄存器,fragment shader中使用此值.此值无变化.
		return o;
	}
	float4 frag(v2f i):COLOR{
		float4 c = float4(i.color.rgb,1); //直接输出 vertex shader中的值. 看看输出的颜色值.
		return c;
	}
	ENDCG
	
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200
		
		Pass{
		
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			ENDCG
		}
	} 
	FallBack "Diffuse"
}
